import { ADMIN_ROLE, NOT_LOGIN, TEACHER_ROLE, STUDENT_ROLE } from './accessEnum.ts' // 注意后缀

export const accessRole = (userRole: string, needRole: string): boolean => {
  if (needRole === NOT_LOGIN) return true
  if (userRole === ADMIN_ROLE) return true
  if (userRole === STUDENT_ROLE && needRole === STUDENT_ROLE) return true
  if (userRole === TEACHER_ROLE && needRole === TEACHER_ROLE) return true
  return false
}
